#include "header.h"

int avion::avioane=0;
int elicopter::elicoptere=0;
int Microbus::microbuze=0;
int Autobus::autobuze=0;

list<string>terestre;
list<string>aeriene;
int x;
firma::firma()
{
	switch(x)
	{
	case 1:
		{
			avion::avioane++;
			string num="avion";
			num.push_back('0'+avion::avioane);
			nume=num;
			aeriene.push_back(num);
			cout<<"S-a creat "<<nume<<".\n";
			_getch();
			break;
		}
	case 2:
		{
			elicopter::elicoptere++;
			string num="elicopter";
			num.push_back('0'+elicopter::elicoptere);
			nume=num;
			aeriene.push_back(num);
			cout<<"S-a creat "<<nume<<".\n";
			_getch();
			break;
		}
	case 3:
		{
			Microbus::microbuze++;
			string num="microbus";
			num.push_back('0'+Microbus::microbuze);
			nume=num;
			terestre.push_back(num);
			cout<<"S-a creat "<<nume<<".\n";
			_getch();
			break;
		}
	case 4:
		{
			Autobus::autobuze++;
			string num="autobus";
			num.push_back('0'+Autobus::autobuze);
			nume=num;
			terestre.push_back(num);
			cout<<"S-a creat "<<nume<<".\n";
			_getch();
			break;
		}
	}
}

avion::avion()
{
/*	avioane++;
	string num="avion";
	num.push_back('0'+avioane);
	nume=num;
	aeriene.push_back(num);
	cout<<"S-a creat "<<nume<<".\n";
	_getch();
*/
}

elicopter::elicopter()
{
/*	elicoptere++;
	string num="elicopter";
	num.push_back('0'+elicoptere);
	nume=num;
	aeriene.push_back(num);
	cout<<"S-a creat "<<nume<<".\n";
	_getch();
*/
}

Microbus::Microbus()
{
/*	microbuze++;
	string num="microbus";
	num.push_back('0'+microbuze);
	nume=num;
	terestre.push_back(num);
	cout<<"S-a creat "<<nume<<".\n";
	_getch();
*/
}

Autobus::Autobus()
{
/*	autobuze++;
	string num="autobus";
	num.push_back('0'+autobuze);
	nume=num;
	terestre.push_back(num);
	cout<<"S-a creat "<<nume<<".\n";
	_getch();
*/
}

int main ()
{
	try
	{
		do
		{	
			system("cls");
			cout<<"1.Introduceti un avion.\n";
			cout<<"2.Introduceti un elecopter.\n";
			cout<<"3.Introduceti un microbus.\n";
			cout<<"4.Introduceti un autobus.\n";
			cout<<"0.Iesire.\n";
			cout<<"Introduceti optiunea:";cin>>x;

			switch(x)
			{
			case 1:
				{
					avion a;
					break;
				}

			case 2:
				{
					elicopter e;
					break;
				}

			case 3:
				{
					Microbus m;
					break;
				}
			case 4:
				{
					Autobus au;
					break;
				}
			}
		}while(x!=0);
	}
	catch(string a)
	{
		cout<<"Ati introdus o optiune gresita."<<endl;
	}
																//afisarea datelor
	cout<<"Sunt "<<terestre.size()<<" vehicule terestre si "<<aeriene.size()<<" aeriene.\n";
	
	aeriene.sort();
	terestre.sort();
	
	cout<<"Sunt "<<terestre.size()+aeriene.size()<<" vehicule : ";
	
	list<string>::iterator it;
	for(it=aeriene.begin();it!=aeriene.end();it++)
		cout<<*it<<", ";
	it=terestre.begin();
	while(it!=terestre.end())
	{	
		cout<<*it;
		++it;
		if(it!=terestre.end())
			cout<<", ";
		else cout<<".\n";
	}
	_getch();
	return 0;
}